<!DOCTYPE html>
<html lang="en">
<title>数据中心</title>
<#import "/layout/layout.html" as body/>
<@body.page>
<div class="wrapper wrapper-content animated fadeInUp">
    <div class="loading"></div>
    <div class="overflow" style='height: 50px;'>
        <div class="pull-left" style='height:30px;float:left;font-size:24px;width: 411px;' id="queryByDayTips">${nowDate!}日数据汇总</div>
        <div class="form-inline " role="form">
            <div class="form-group">
                <div class="form-group date-rangepicker">
                    <label for="daterange">日期：</label>
                    <input class="form-control" id="daterange" type="text" name="daterange" style="width: 280px"/>
                    <input type="hidden" id="daterange_value" name="daterange_value" value=${daterange!}/>
                </div>
            </div>
            <button type="submit" class="btn btn-default" onclick="queryDataByDays()">查询</button>
        </div>
    </div>
    <div class="row is-col">
        <div class="col-lg-3 col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 class="pull-left">当期实收金额</h5>
                    <span class="label label-success pull-right btn btn-sm" id="modal-1">查看详情</span>
                    <!-- <input type="hidden" id="incomeAmtDetailByDay" name="incomeAmtDetailByDay" value=${dataByDay.byDayCountAmtDetail!}  /> -->
                </div>
                <div class="ibox-content" id="incomeAmtByDay">
                    <h1 class="no-margins" id="daysByAmt">${dataByDay.byDayCountAmt!}</h1>
                </div>
            </div>
        </div>
        <div class="col-lg-3 col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 class="pull-left">当期订单总数</h5>
                    <span class="label label-info pull-right btn btn-sm" id="modal-2">查看详情</span>
                    <!-- <input type="hidden" id="orderDetailByDay" name="orderDetailByDay" value=${dataByDay.byDayOrderCountDetail!}  /> -->
                </div>
                <div class="ibox-content" id="orderCountByDay">
                    <h1 class="no-margins">${dataByDay.byDayOrderCount!}</h1>
                </div>
            </div>
        </div>
        <div class="col-lg-3 col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 class="pull-left">当期新增会员</h5>
                    <span class="label label-primary pull-right btn btn-sm" id="modal-3">查看详情</span>
                    <!-- <input type="hidden" id="newVipCountDetailByDay" name="newVipCountByDayDetail" value=${dataByDay.byDayNewVipCountDeatil!}  /> -->
                </div>
                <div class="ibox-content" id="newVipCountByDay">
                    <h1 class="no-margins">${dataByDay.byDayNewVipCount!}</h1>
                </div>
            </div>
        </div>
        <div class="col-lg-3 col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>当期会员收入</h5>
                </div>
                <div class="ibox-content" id="vipOrderAmtByDay">
                    <h1 class="no-margins">${dataByDay.byDayVIPOrderAmt!}</h1>
                </div>
            </div>
        </div>

        <!--2017-2-8 新增-->
        <div class="col-lg-3 col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 class="pull-left">当期付费渗透率</h5>
                </div>
                <div class="ibox-content" id="payInfiltrationRate">
                    <h1 class="no-margins" id="daysByAmt1">${dataByDay.byDayPayInfiltrationRate!}%</h1>
                </div>
            </div>
        </div>
        <div class="col-lg-3 col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 class="pull-left">当期会员零售转化率</h5>
                </div>
                <div class="ibox-content" id="vipOrderConversionRate">
                    <h1 class="no-margins">${dataByDay.byDayVipOrderConversionRate!}%</h1>
                </div>
            </div>
        </div>
        <div class="col-lg-3 col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 class="pull-left">当期零售复购率</h5>
                    <span class="label label-primary pull-right btn btn-sm" id="modal-4">查看详情</span>
                    <!-- <input type="hidden" id="repeatChargeRateDetailByDay" name="repeatChargeRateDetailByDay" value="${dataByDay.byDayRetailRepeatChargeRate!}"  />
                  
                    <input type="hidden" id="repeatVIPChargeRateDetailByDay" name="repeatVIPChargeRateDetailByDay" value="${dataByDay.byDayVIPRetailRepeatChargeRate!}"  />
                    <input type="hidden" id="repeatNOVIPChargeRateDetailByDay" name="repeatNOVIPChargeRateDetailByDay" value="${dataByDay.byDayNOVIPRetailRepeatChargeRate!}"  />   -->
                </div>
                <div class="ibox-content" id="retailRepeatChargeRate">
                    <h1 class="no-margins">${dataByDay.byDayRetailRepeatChargeRate!}%</h1>
                </div>
            </div>
        </div>
        
        
        <div class="col-lg-3 col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>当期团课满课率</h5>
                    <span class="label label-primary pull-right btn btn-sm" id="modal-6">查看详情</span>
                    <!--   <input type="hidden" id="teamFullClassRateDetail" name="teamFullClassRateDetail" value= ${dataByDay.byDayTeamFullClassRateDetail!} />-->
                </div>
                <div class="ibox-content" id="teamFullClassRate">
                    <h1 class="no-margins">${dataByDay.byDayTeamFullClassRate!}%</h1>
                </div>
            </div>
        </div>
        <!--2017-2-8 新增 end-->
        <div class="col-lg-3 col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>普通用户自助复购率</h5>
                    <!-- <span class="label label-primary pull-right btn btn-sm" id="modal-6">查看详情</span>
                       <input type="hidden" id="teamFullClassRateDetail" name="teamFullClassRateDetail" value= ${dataByDay.byDayTeamFullClassRateDetail!} />-->
                </div>
                <div class="ibox-content" id="noVipSlefRepeatChargeRate">
                    <h1 class="no-margins">${dataByDay.byDayNoVipSlefRepeatChargeRate!}%</h1>
                </div>
            </div>
        </div>

        <div class="col-lg-3 col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>当期付费用户总数</h5>
                    <!-- <span class="label label-primary pull-right btn btn-sm" id="modal-6">查看详情</span>
                       <input type="hidden" id="teamFullClassRateDetail" name="teamFullClassRateDetail" value= ${dataByDay.byDayTeamFullClassRateDetail!} />-->
                </div>
                <div class="ibox-content" id="dayPayUserCount">
                    <h1 class="no-margins">${dataByDay.byDayPayUserCount!}</h1>
                </div>
            </div>
        </div>

        <div class="col-lg-3 col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>会员自助转化率</h5>
                    <!-- <span class="label label-primary pull-right btn btn-sm" id="modal-6">查看详情</span>
                       <input type="hidden" id="teamFullClassRateDetail" name="teamFullClassRateDetail" value= ${dataByDay.byDayTeamFullClassRateDetail!} />-->
                </div>
                <div class="ibox-content" id="vipUserSelfOrderRate">
                    <h1 class="no-margins">${dataByDay.byDayVipUserSelfOrderRate!}%</h1>
                </div>
            </div>
        </div>

        <div class="col-lg-3 col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>普通用户自助转化率</h5>
                    <!-- <span class="label label-primary pull-right btn btn-sm" id="modal-6">查看详情</span>
                       <input type="hidden" id="teamFullClassRateDetail" name="teamFullClassRateDetail" value= ${dataByDay.byDayTeamFullClassRateDetail!} />-->
                </div>
                <div class="ibox-content" id="NOVipUserSelfOrderRate">
                    <h1 class="no-margins">${dataByDay.byDayNOVipUserSelfOrderRate!}%</h1>
                </div>
            </div>
        </div>
        
        <div class="col-lg-3 col-sm-6">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>到期未续费用户数</h5>
                    <!-- <span class="label label-primary pull-right btn btn-sm" id="modal-6">查看详情</span>
                       <input type="hidden" id="teamFullClassRateDetail" name="teamFullClassRateDetail" value= ${dataByDay.byDayTeamFullClassRateDetail!} />-->
                </div>
                <div class="ibox-content" id="vipExpiredCountDiv">
                    <h1 class="no-margins">${dataByDay.byDayVipExpiredCount!}</h1>
                </div>
            </div>
        </div>
        
        <div class="col-lg-3 col-sm-6" id="vipUserCountWarpperDiv">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>檬会员用户数</h5>
                    <!-- <span class="label label-primary pull-right btn btn-sm" id="modal-6">查看详情</span>
                       <input type="hidden" id="teamFullClassRateDetail" name="teamFullClassRateDetail" value= ${dataByDay.byDayTeamFullClassRateDetail!} />-->
                </div>
                <div class="ibox-content" id="VipUserCount">
                    <h1 class="no-margins">${dataByDay.byDayVipUserCount!}</h1>
                </div>
            </div>
        </div>
        

    </div>
    <div class="overflow">
        <h2 class="pull-left" id="weekRangeTips">周相关数据 (${lastWeekStartDay!} 至 ${lastWeekEndDay!})</h2>
        <form class="form-inline pull-right" role="form" style="margin: 15px 0">
            <div class="form-group">
                <!--  <input type="email" class="form-control" id="exampleInputEmail2" placeholder="按过往周查询">-->
                <input type="hidden" id="start_weekrange" name="start_weekrange" value=${lastWeekStartDay!}/>
                <input type="hidden" id="end_weekrange" name="end_weekrange" value=${lastWeekEndDay!}/>
                <select class="form-control" id="weekDaterange">
                    <#if weekdaterange??>
                        <#list weekdaterange as list>
                            <option value="${list.value!}" <#if list_index = 1>selected="true" </#if> 
                            >${list.key!}</option>
                        </#list>
                    </#if>
                </select>
            </div>
            <button type="button" class="btn btn-default" onclick="queryWeekData();">查询</button>
        </form>
    </div>
    <div class="row is-col">
        <div class="col-lg-6 col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 class="pull-left">周排课量</h5>
                    <span class="label label-success pull-right btn btn-sm" id="modal-5">查看详情</span>
                    <!-- <input type="hidden" id="weekCourseCountDetail" name="weekCourseCountDetail" value= ${dataByWeek.byWeekCourseCountDetail!} /> -->
                </div>
                <div class="ibox-content" id="weekCourseCountDiv">
                    <h1 class="no-margins">${dataByWeek.byWeekCourseCount!}</h1>
                </div>
            </div>
        </div>
        <div class="col-lg-6 col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 class="pull-left">周用户平均购买次数</h5>
                </div>
                <div class="ibox-content" id="weekUserAvgChargeCountDiv">
                    <h1 class="no-margins">${dataByWeek.byWeekUserAvgChargeCount!}</h1>
                </div>
            </div>
        </div>

    </div>
    <div class="overflow">
        <h2 class="pull-left" id="yearMonthDate">月相关数据(${lastMonth!})</h2>
        <form class="form-inline pull-right" role="form" style="margin: 15px 0">
            <div class="form-group">
                <select class="form-control" id="yearMonth">
                    <#if monthdaterange??>
                        <#list monthdaterange as list>
                        		<option value="${list.value!}" <#if list_index = 1>selected="true" </#if> 
                        		>${list.key!}</option>
                        </#list>
                    </#if>
                </select>
            </div>
            <button type="button" class="btn btn-default" onclick="queryDataCenterByMonth()">查询</button>
        </form>
    </div>
    <div class="row is-col">
        <div class="col-lg-4 col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 class="pull-left">月会员续费率</h5>
                    <!-- <span class="label label-success pull-right btn btn-sm" id="modal-12">查看详情</span> -->
                </div>
                <div class="ibox-content" id="vipOrderRepeatChargeRateDataDiv">
                    <h1 class="no-margins">${dataByMonth.byMonthVipOrderRepeatChargeRate!}%</h1>
                    <!--  <div class="stat-percent font-bold text-success">98% <i class="fa fa-bolt"></i></div>
                    <small>环比</small>-->
                </div>
            </div>
        </div>
        <div class="col-lg-4 col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 class="pull-left">月用户平均购买次数</h5>
                </div>
                <div class="ibox-content" id="userAvgChargeCountDataDiv">
                    <h1 class="no-margins">${dataByMonth.byMonthUserAvgChargeCount!}</h1>
                </div>
            </div>
        </div>

        <div class="col-lg-4 col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 class="pull-left">月会员实收金额</h5>
                </div>
                <div class="ibox-content" id="vipAmtByPerMonth">
                    <h1 class="no-margins">${dataByMonth.byMonthVipAmtByPerMonth!}</h1>
                </div>
            </div>
        </div>


        <h2>排行数据相关</h2>
        <div class="row is-col">
            <div class="col-lg-4 col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>教练重复购买率排名</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-sm-6 m-b-xs">
                                <div class="input-group">
                                    <input type="text" placeholder="请选择日期查询" class="input-sm form-control check_date" id="sort_datarange1">
                                    <span class="input-group-btn">
                                    <button type="button" class="btn btn-sm btn-primary" onclick="queryCoachSortData();">查询</button>
                                </span>
                                </div>
                            </div>
                        </div>
                        <div class="table-responsive">
                            <table class="table table-striped">
                                <thead>
                                <tr>
                                    <th>排名</th>
                                    <th>教练</th>
                                    <th>百分比</th>
                                </tr>
                                </thead>
                                <tbody id="coachDataDiv">
                                <#if dataByAll.coachSortList??>
                                    <#list dataByAll.coachSortList as list>
                                        <tr>
                                            <td>${list_index+1!}</td>
                                            <td>${list.name!}</td>
                                            <td><span class="label label-info">${list.rate!}%</span></td>
                                        </tr>
                                    </#list>
                                </#if>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-lg-4 col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>课程重复购买率排名</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-sm-6 m-b-xs">
                                <div class="input-group">
                                    <input type="text" placeholder="请选择日期查询" class="input-sm form-control check_date" id="sort_datarange2">
                                    <span class="input-group-btn">
                                    <button type="button" class="btn btn-sm btn-info" onclick="queryCourseSortData();"> 查询</button>
                                </span>
                                </div>
                            </div>
                        </div>
                        <div class="table-responsive">
                            <table class="table table-striped">
                                <thead>
                                <tr>
                                    <th>排名</th>
                                    <th>课程</th>
                                    <th>百分比</th>
                                </tr>
                                </thead>
                                <tbody id="courseDataDiv">
                                <#if dataByAll.courseSortList??>
                                    <#list dataByAll.courseSortList as list>
                                        <tr>
                                            <td>${list_index+1!}</td>
                                            <td>${list.name!}</td>
                                            <td><span class="label label-info">${list.rate!}%</span></td>
                                        </tr>
                                    </#list>
                                </#if>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-lg-4 col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>团课满课率排名</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <div class="col-sm-6 m-b-xs">
                                <div class="input-group">
                                    <input type="text" placeholder="请选择日期查询" class="input-sm form-control check_date" id="sort_datarange3">
                                    <span class="input-group-btn">
                                    <button type="button" class="btn btn-sm btn-info" onclick="queryTeamFullClassRateSort();"> 查询</button>
                                </span>
                                </div>
                            </div>
                        </div>
                        <div class="table-responsive">
                            <table class="table table-striped">
                                <thead>
                                <tr>
                                    <th>排名</th>
                                    <th>课程</th>
                                    <th>百分比</th>
                                </tr>
                                </thead>
                                <tbody id="teamCourseDataDiv">
                                <#if dataByAll.teamFullClassRateSort??>
                                    <#list dataByAll.teamFullClassRateSort as list>
                                        <tr>
                                            <td>${list_index+1!}</td>
                                            <td>${list.name!}</td>
                                            <td><span class="label label-info">${list.rate!}%</span></td>
                                        </tr>
                                    </#list>
                                </#if>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            
            
        </div>

        <!--实收明细模态框-->
        <div class="modal fade bs-example-modal-lg-1" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
             aria-hidden="true">
            <div class="modal-dialog modal-lg" style="margin-top: 200px">
                <div class="modal-content" style="padding: 20px">
                    <h3>实收明细</h3>
                    <ul class="folder-list m-b-md category-list" style="padding: 0">
                        <div id="amtdetial">
                        </div>
                    </ul>
                </div>
            </div>
        </div>

        <!--订单明细模态框-->
        <div class="modal fade bs-example-modal-lg-2" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
             aria-hidden="true">
            <div class="modal-dialog modal-lg" style="margin-top: 200px">
                <div class="modal-content" style="padding: 20px">
                    <h3>订单明细</h3>
                    <ul class="folder-list m-b-md category-list" style="padding: 0">
                        <div id="orderDetail">
                        </div>
                    </ul>
                </div>
            </div>
        </div>

        <!--新增会员明细模态框-->
        <div class="modal fade bs-example-modal-lg-3" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
             aria-hidden="true">
            <div class="modal-dialog modal-lg" style="margin-top: 200px">
                <div class="modal-content" style="padding: 20px">
                    <h3>新增会员明细</h3>
                    <ul class="folder-list m-b-md category-list" style="padding: 0">
                        <div id="newVipDetail">
                        </div>
                    </ul>
                </div>
            </div>
        </div>

        <div class="modal fade bs-example-modal-lg-4" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
             aria-hidden="true">
            <div class="modal-dialog modal-lg" style="margin-top: 200px">
                <div class="modal-content" style="padding: 20px">
                    <h3>零售复购率明细</h3>
                    <ul class="folder-list m-b-md category-list" style="padding: 0">
                        <div id="repeatChargeRateDetail">
                        </div>
                    </ul>
                </div>
            </div>
        </div>

        <div class="modal fade bs-example-modal-lg-5" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
             aria-hidden="true">
            <div class="modal-dialog modal-lg" style="margin-top: 200px">
                <div class="modal-content" style="padding: 20px">
                    <h3>团课周排课量明细</h3>
                    <ul class="folder-list m-b-md category-list" style="padding: 0">
                        <div id="weekCourseCountDetailDiv">
                        </div>
                    </ul>
                </div>
            </div>
        </div>

        <div class="modal fade bs-example-modal-lg-6" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
             aria-hidden="true">
            <div class="modal-dialog modal-lg" style="margin-top: 200px">
                <div class="modal-content" style="padding: 20px">
                    <h3>团课满课率明细</h3>
                    <ul class="folder-list m-b-md category-list" style="padding: 0">
                        <div id="teamFullClassRateDetailDiv">
                        </div>
                    </ul>
                </div>
            </div>
        </div>


		
	</div>
</div>
<div class="modal-loading"></div>
<style>
	.modal-loading{position: fixed;top:0;left:0;width: 100%;height: 100%;z-index: 10000;background: rgba(0,0,0,.5) url("${baseUrl}img/loading.gif") no-repeat center; display: none}
</style>
<script>

    var dayCountAmt1 = ${dataByDay.byDayCountAmt!};
    var dayOrderCount1 = ${dataByDay.byDayOrderCount!};
    var dayNewVipCount1 =  ${dataByDay.byDayNewVipCount!};
    var dayRetailRepeatChargeRate1 =${dataByDay.byDayRetailRepeatChargeRate!};
    var dayTeamFullClassRate1 = ${dataByDay.byDayTeamFullClassRate!};
    var weekCourseCount1 = ${dataByWeek.byWeekCourseCount!};


    function queryDataByDays() {
    	
        var daterange = $("#daterange").val();
        if (daterange == "") {
            swal("失败", "条件查询示请输入日期区间", "error");
            return false;
        }
        
        $('.modal-loading').show();
        $.ajax({
            type: "post",
            url: "query_data_center_days",
            data: {"daterange": daterange},
            success: function (result) {
                if (result) {
                	//$('.bs-example-modal-lg-1').modal('hide');
                    $("#queryByDayTips").empty();
                    $("#incomeAmtByDay").empty();
                    $("#orderCountByDay").empty();
                    $("#newVipCountByDay").empty();
                    $("#vipOrderAmtByDay").empty();
                    $("#payInfiltrationRate").empty();
                    $("#vipOrderConversionRate").empty();
                    $("#retailRepeatChargeRate").empty();
                    $("#teamFullClassRate").empty();
                    $("#noVipSlefRepeatChargeRate").empty();
                    $("#dayPayUserCount").empty();
                    $("#vipUserSelfOrderRate").empty();
                    $("#NOVipUserSelfOrderRate").empty();
                    $("#VipUserCount").empty();
                    $("#vipExpiredCountDiv").empty();
                    $("#vipUserCountWarpperDiv").hide();


                    $("#modal-1").empty();
                    $("#modal-2").empty();
                    $("#modal-3").empty();
                    $("#modal-4").empty();

                    $("#daterange_value").val(result.daterange);

                    var html0 = '(' + result.daterange + ')期间数据';
                    $("#queryByDayTips").html(html0);
                    //订单金额
                    var incomeAmt = result.countDataByDays.byLastWeekCountAmt;
                    debugger
                    if (incomeAmt > 0) {
                        $("#modal-1").html('查看详情');
                    }
                    var html1 = '<h1 class="no-margins" id="daysByAmt">' + incomeAmt + '</h1>';
                    $("#incomeAmtByDay").html(html1);
                    //$("#incomeAmtDetailByDay").val(result.countDataByDays.byLastWeekCountAmtDetail);

                    var orderCount = result.countDataByDays.byLastWeekOrderCount;
                    if (orderCount > 0) {
                        $("#modal-2").html('查看详情');
                    }
                    var html2 = '<h1 class="no-margins">' + orderCount + '</h1>';
                    $("#orderCountByDay").html(html2);
                    //$("#orderDetailByDay").val(result.countDataByDays.byLastWeekOrderCountDetail);

                    var newVipCount = result.countDataByDays.byLastWeekNewVipCount;
                    if (newVipCount > 0) {
                        $("#modal-3").html('查看详情');
                    }
                    var html3 = '<h1 class="no-margins">' + newVipCount + '</h1>';
                    $("#newVipCountByDay").html(html3);
                    //$("#newVipCountDetailByDay").val(result.countDataByDays.byLastWeekNewVipCountDeatil);

                    var html4 = '<h1 class="no-margins">' + result.countDataByDays.byLastWeekVIPOrderAmt + '</h1>';
                    $("#vipOrderAmtByDay").html(html4);

                    var html5 = '<h1 class="no-margins">' + result.countDataByDays.byDayPayInfiltrationRate + '%</h1>';
                    $("#payInfiltrationRate").html(html5);

                    var html6 = '<h1 class="no-margins">' + result.countDataByDays.byDayVipOrderConversionRate + '%</h1>';
                    $("#vipOrderConversionRate").html(html6);

                    var retailRepeatChargeRate = result.countDataByDays.byDayRetailRepeatChargeRate;
                    if (retailRepeatChargeRate > 0) {
                        $("#modal-4").html('查看详情');
                    }
                    var html7 = '<h1 class="no-margins">' + retailRepeatChargeRate + '%</h1>';
                    $("#retailRepeatChargeRate").html(html7);
                    //	$("#repeatVIPChargeRateDetailByDay").val(result.countDataByDays.byDayVIPRetailRepeatChargeRate);
                    // $("#repeatNOVIPChargeRateDetailByDay").val(result.countDataByDays.byDayNOVIPRetailRepeatChargeRate);

                    var dayTeamFullClassRate = result.countDataByDays.byDayTeamFullClassRate;
                    if (dayTeamFullClassRate > 0) {
                        $("#modal-6").html('查看详情');
                    }
                    //$("#teamFullClassRateDetail").val(result.countDataByDays.byDayTeamFullClassRateDetail);
                    var html8 = '<h1 class="no-margins">' + result.countDataByDays.byDayTeamFullClassRate + '%</h1>';
                    $("#teamFullClassRate").html(html8);

                    var html9 = '<h1 class="no-margins">' + result.countDataByDays.byDayNoVipSlefRepeatChargeRate + '%</h1>';
                    $("#noVipSlefRepeatChargeRate").html(html9);

                    var html10 = '<h1 class="no-margins">' + result.countDataByDays.byDayPayUserCount + '</h1>';
                    $("#dayPayUserCount").html(html10);

                    var html11 = '<h1 class="no-margins">' + result.countDataByDays.byDayVipUserSelfOrderRate + '%</h1>';
                    $("#vipUserSelfOrderRate").html(html11);

                    var html12 = '<h1 class="no-margins">' + result.countDataByDays.byDayNOVipUserSelfOrderRate + '%</h1>';
                    $("#NOVipUserSelfOrderRate").html(html12);
                    
                    var html13 = '<h1 class="no-margins">' + result.countDataByDays.byDayVipExpiredCount + '</h1>';
                    $("#vipExpiredCountDiv").html(html13);
                    
                    $('.modal-loading').hide();
                }
               
            }
        });
    }

    function queryWeekData() {
    	
        var weekDaterange = $("#weekDaterange").val();
        if (weekDaterange == "") {
            swal("失败", "请输入月份", "error");
            return false;
        }
        $('.modal-loading').show();
        $.ajax({
            type: "post",
            url: "query_data_weekdaterange",
            data: {"weekdaterange": weekDaterange},
            success: function (result) {
                if (result) {
                    $("#modal-5").empty();
                    $("#weekRangeTips").empty();
                    $("#weekCourseCountDiv").empty();
                    $("#weekUserAvgChargeCountDiv").empty();

                    var startDate = result.startDate;
                    var endDate = result.endDate;
                    $("#start_weekrange").val(startDate);
                    $("#end_weekrange").val(endDate);

                    var html0 = '周相关数据(' + startDate + '至' + endDate + ')';
                    $("#weekRangeTips").html(html0);

                    var weekCourseCount = result.weekCourseCount;
                    var html1 = '<h1 class="no-margins">' + weekCourseCount + '</h1>';
                    $("#weekCourseCountDiv").html(html1);
                    if (weekCourseCount > 0) {
                        $("#modal-5").html('查看详情');
                        //$("#weekCourseCountDetail").val(result.weekCourseCountDetail);
                    }
                    var html2 = '<h1 class="no-margins">' + result.weekUserAvgChargeCount + '</h1>';
                    $("#weekUserAvgChargeCountDiv").html(html2);
                    
                    $('.modal-loading').hide();
                }
            }
        });
    }

    function queryDataCenterByMonth() {
        var yearMonth = $("#yearMonth").val();
        if (yearMonth == "") {
            swal("失败", "请输入月份", "error");
            return false;
        }
        $('.modal-loading').show();
        $.ajax({
            type: "post",
            url: "query_data_yearmonth",
            data: {"yearMonth": yearMonth},
            success: function (result) {
                if (result) {
                    $("#yearMonthDate").empty();
                    $("#vipOrderRepeatChargeRateDataDiv").empty();
                    $("#userAvgChargeCountDataDiv").empty();
                    $("#vipAmtByPerMonth").empty();

                    var html0 = '月相关数据(' + yearMonth + ')';
                    $("#yearMonthDate").html(html0);

                    var yearMonthVipOrderRepeatChargeRage = result.yearMonthVipOrderRepeatChargeRage;
                    var html1 = '<h1 class="no-margins">' + yearMonthVipOrderRepeatChargeRage + '%</h1>';
                    $("#vipOrderRepeatChargeRateDataDiv").html(html1);

                    var yearMonthUserAvgChargeCount = result.yearMonthUserAvgChargeCount;
                    var html2 = '<h1 class="no-margins">' + yearMonthUserAvgChargeCount + '</h1>';
                    $("#userAvgChargeCountDataDiv").html(html2);

                    var vipAmtByPerMonth = result.yearMonthVipAmtByPerMonth;
                    var html3 = '<h1 class="no-margins">' + vipAmtByPerMonth + '</h1>';
                    $("#vipAmtByPerMonth").html(html3);
                    
                    $('.modal-loading').hide();
                }
            }
        });
    }

    function queryCoachSortData() {
        var sort_datarange1 = $("#sort_datarange1").val();
        if (sort_datarange1 == "") {
            swal("失败", "请输入月份", "error");
            return false;
        }
        $('.modal-loading').show();
        $.ajax({
            type: "post",
            url: "query_data_coach_sort",
            data: {"sort_datarange1": sort_datarange1},
            success: function (result) {
                if (result) {
                    $("#coachDataDiv").empty();
                    var list = new Array();
                    debugger;
                    list = result.coachSortData;
                    var innerHtml = "";
                    $.each(list, function (i, data) {
                        innerHtml += '<tr><td>' + (i + 1) + '</td>' + '<td>' + data.name + '</td>' + '<td><span class="label label-info">' + data.rate + '%</span></td></tr>';
                    });

                    $("#coachDataDiv").html(innerHtml);
                    
                    $('.modal-loading').hide();
                }
            }
        });
    }

    function queryCourseSortData() {
        var sort_datarange2 = $("#sort_datarange2").val();
        if (sort_datarange2 == "") {
            swal("失败", "请输入月份", "error");
            return false;
        }
        
        $('.modal-loading').show();
        $.ajax({
            type: "post",
            url: "query_data_course_sort",
            data: {"sort_datarange2": sort_datarange2},
            success: function (result) {
                if (result) {
                    $("#courseDataDiv").empty();
                    var list = new Array();
                    debugger;
                    list = result.courseSortData;
                    var innerHtml = "";
                    $.each(list, function (i, data) {
                        innerHtml += '<tr><td>' + (i + 1) + '</td>' + '<td>' + data.name + '</td>' + '<td><span class="label label-info">' + data.rate + '%</span></td></tr>';
                    });
                    $("#courseDataDiv").html(innerHtml);
                    $('.modal-loading').hide();
                }
            }
        });
    }
    
    function queryTeamFullClassRateSort() {
        var sort_datarange3 = $("#sort_datarange3").val();
        if (sort_datarange3 == "") {
            swal("失败", "请输入月份", "error");
            return false;
        }
        debugger;
        $('.modal-loading').show();
        $.ajax({
            type: "post",
            url: "query_team_full_class_rate_sort",
            data: {"sort_datarange3": sort_datarange3},
            success: function (result) {
                if (result) {
                    $("#teamCourseDataDiv").empty();
                    var list = new Array();
                    debugger;
                    list = result.teamFullClassRateSort;
                    var innerHtml = "";
                    $.each(list, function (i, data) {
                        innerHtml += '<tr><td>' + (i + 1) + '</td>' + '<td>' + data.name + '</td>' + '<td><span class="label label-info">' + data.rate + '%</span></td></tr>';
                    });
                    $("#teamCourseDataDiv").html(innerHtml);
                    $('.modal-loading').hide();
                }
            }
        });
    }


    $(function () {
        $('input[name="daterange"]').daterangepicker({
            startDate: moment().startOf('day'),
            endDate: moment(),
            //minDate: '01/01/2012',    //最小时间
            //maxDate: moment(), //最大时间
            dateLimit: {days: 365}, //起止时间的最大间隔
            showDropdowns: true,
            showWeekNumbers: false, //是否显示第几周
            timePicker: false, //是否显示小时和分钟
            timePickerIncrement: 60, //时间的增量，单位为分钟
            timePicker12Hour: false, //是否使用12小时制来显示时间
            ranges: {
                //'最近1小时': [moment().subtract('hours',1), moment()],
                '今日': [moment().startOf('day'), moment()],
                '昨日': [moment().subtract('days', 1).startOf('day'), moment().subtract('days', 1).endOf('day')],
                '最近7日': [moment().subtract('days', 6), moment()],
                '最近30日': [moment().subtract('days', 30), moment()]
            },
            opens: 'right', //日期选择框的弹出位置
            buttonClasses: ['btn btn-default'],
            applyClass: 'btn-small btn-primary blue',
            cancelClass: 'btn-small',
            format: 'YYYY-MM-DD', //控件中from和to 显示的日期格式 YYYY-MM-DD HH:mm:ss
            separator: '~',
            locale: {
                applyLabel: '确定',
                cancelLabel: '取消',
                fromLabel: '起始时间',
                toLabel: '结束时间',
                customRangeLabel: '自定义',
                daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
                    '七月', '八月', '九月', '十月', '十一月', '十二月'],
                firstDay: 1
            }
        }, function (start, end, label) {//格式化日期显示框
            $('.date-rangepicker span').html(start.format('YYYY-MM-DD HH:mm:ss') + ' - ' + end.format('YYYY-MM-DD HH:mm:ss'));
        });

        //教练重复购买率排名
        $('.check_date').daterangepicker({
            startDate: moment().startOf('day'),
            endDate: moment(),
            //minDate: '01/01/2012',    //最小时间
            //maxDate: moment(), //最大时间
            dateLimit: {days: 365}, //起止时间的最大间隔
            showDropdowns: true,
            showWeekNumbers: false, //是否显示第几周
            timePicker: false, //是否显示小时和分钟
            timePickerIncrement: 60, //时间的增量，单位为分钟
            timePicker12Hour: false, //是否使用12小时制来显示时间
            ranges: {
                //'最近1小时': [moment().subtract('hours',1), moment()],
                // '今日': [moment().startOf('day'), moment()],
                // '昨日': [moment().subtract('days', 1).startOf('day'), moment().subtract('days', 1).endOf('day')],
                '最近7日': [moment().subtract('days', 6), moment()],
                '最近30日': [moment().subtract('days', 30), moment()]
            },
            opens: 'right', //日期选择框的弹出位置
            buttonClasses: ['btn btn-default'],
            applyClass: 'btn-small btn-primary blue',
            cancelClass: 'btn-small',
            format: 'YYYY-MM-DD', //控件中from和to 显示的日期格式 YYYY-MM-DD HH:mm:ss
            separator: '~',
            locale: {
                applyLabel: '确定',
                cancelLabel: '取消',
                fromLabel: '起始时间',
                toLabel: '结束时间',
                customRangeLabel: '自定义',
                daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
                    '七月', '八月', '九月', '十月', '十一月', '十二月'],
                firstDay: 1
            }
        }, function (start, end, label) {//格式化日期显示框
            $('.date-rangepicker span').html(start.format('YYYY-MM-DD HH:mm:ss') + ' - ' + end.format('YYYY-MM-DD HH:mm:ss'));
        });


        if (dayCountAmt1 <= 0) {
            $("#modal-1").empty();
        }
        if (dayOrderCount1 <= 0) {
            $("#modal-2").empty();
        }
        if (dayNewVipCount1 <= 0) {
            $("#modal-3").empty();
        }
        if (dayRetailRepeatChargeRate1 <= 0) {
            $("#modal-4").empty();
        }
        if (weekCourseCount1 <= 0) {
            $("#modal-5").empty();
        }
        if (dayTeamFullClassRate1 <= 0) {
            $("#modal-6").empty();
        }


        //**************今日数据汇总*************************///
        $('#exampleInputEmail1').datetimepicker({
            language: 'zh-CN',
            weekStart: 1,
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: 1,
            startView: 2,
            forceParse: 0,
            showMeridian: 0,
            minView: "month",
            format: "yyyy-mm-dd"
        });

        /**
         $("#modal-1").click(function () {
        	$("#amtdetial").empty();
        	var innerHtml="";
        	var list = new Array(); 
        		list = JSON.parse($("#incomeAmtDetailByDay").val());
        	$.each(list, function (i, data) {
        			innerHtml+='<li><a href="#"><i class="fa fa-circle text-navy"></i>'+data.storeName +': ¥'+data.incomeAmt+'</a></li>';
            });
        	$("#amtdetial").html(innerHtml);
            $('.bs-example-modal-lg-1').modal('toggle');
        });
         */
        $("#modal-1").click(function () {
            debugger;
            $("#amtdetial").empty();
            var daterange_value = $("#daterange_value").val();
            
            $('.modal-loading').show();
            $.ajax({
                type: "post",
                url: "queryCountAmtDetail",
                data: {"daterange": daterange_value},
                success: function (result) {
                    if (result) {
                        debugger;
                        var innerHtml = "";
                        $.each(result.countAmtDetail, function (i, data) {
                            innerHtml += '<li><a href="#"><i class="fa fa-circle text-navy"></i>' + data.storeName + ': ¥' + data.incomeAmt + '</a></li>';
                        });
                        $("#amtdetial").html(innerHtml);
                        $('.modal-loading').hide();
                        $('.bs-example-modal-lg-1').modal('toggle');
                        
                    }
                }
            });
        });

        /**
         $("#modal-2").click(function () {
        	$("#orderDetail").empty();
        	var innerHtml="";
        	var list = new Array(); 
        	list=JSON.parse($("#orderDetailByDay").val());
        		//${dataByDay.byDayOrderCountDetail!} 
        	$.each(list, function (i, data) {
    			innerHtml+='<li><a href="#"><i class="fa fa-circle text-navy"></i>'+data.storeName+'：'+data.allOrderCount+'笔（团课：'+data.teamOrderCount+'；私教：'+data.ptOrderCount+'；训练营：'+data.funCampOrderCount+'；自助：'+data.selfOrderCount+'）</a></li>';
        	});
        	$("#orderDetail").html(innerHtml);
            $('.bs-example-modal-lg-2').modal('toggle');
        });*/
        $("#modal-2").click(function () {
            debugger;
            $("#orderDetail").empty();
            var daterange_value = $("#daterange_value").val();
            $('.modal-loading').show();
            $.ajax({
                type: "post",
                url: "queryOrderCountDetail",
                data: {"daterange": daterange_value},
                success: function (result) {
                    if (result) {
                        debugger;
                        var innerHtml = "";
                        $.each(result.orderCountDetail, function (i, data) {
                            innerHtml += '<li><a href="#"><i class="fa fa-circle text-navy"></i>' + data.storeName + '：' + data.allOrderCount + '笔（团课：' + data.teamOrderCount + '；私教：' + data.ptOrderCount + '；训练营：' + data.funCampOrderCount + '；自助：' + data.selfOrderCount + '）</a></li>';
                        });
                        $("#orderDetail").html(innerHtml);
                        $('.modal-loading').hide();
                        $('.bs-example-modal-lg-2').modal('toggle');
                        
                    }
                }
            });
        });


        $("#modal-3").click(function () {
            debugger;
            $("#newVipDetail").empty();
            var daterange_value = $("#daterange_value").val();
            $('.modal-loading').show();
            $.ajax({
                type: "post",
                url: "queryNewVipCountDeatil",
                data: {"daterange": daterange_value},
                success: function (result) {
                    if (result) {
                        debugger;
                        var innerHtml = "";
                        $.each(result.newVipCountDeatil, function (i, data) {
                            innerHtml += '<li><a href="#"><i class="fa fa-circle text-navy"></i>购买' + data.typeName + '：' + data.sumNum + '</a></li>';
                        });
                        $("#newVipDetail").html(innerHtml);
                        $('.modal-loading').hide();
                        $('.bs-example-modal-lg-3').modal('toggle');
                        
                    }
                }
            });
        });

        /**
         $("#modal-3").click(function () {
        	$("#newVipDetail").empty();
        	var innerHtml="";
        	var list = new Array(); 
        	list=JSON.parse($("#newVipCountDetailByDay").val());	
        		//${dataByDay.byDayNewVipCountDeatil!} 
        	$.each(list, function (i, data) {
        			innerHtml+='<li><a href="#"><i class="fa fa-circle text-navy"></i>购买'+data.typeName+'：'+data.sumNum + '</a></li>';
            });
        	$("#newVipDetail").html(innerHtml);
            $('.bs-example-modal-lg-3').modal('toggle');
        });
         */


        $("#modal-4").click(function () {
            $("#repeatChargeRateDetail").empty();
            var daterange_value = $("#daterange_value").val();
            $('.modal-loading').show();
            $.ajax({
                type: "post",
                url: "queryRetailRepeatChargeRateDetail",
                data: {"daterange": daterange_value},
                success: function (result) {
                    if (result) {
                        var innerHtml = "";
                        innerHtml += '<li><a href="#"><i class="fa fa-circle text-navy"></i>会员零售复购率：' + result.vipRetailRepeatChargeRate + '%</a></li>';
                        innerHtml += '<li><a href="#"><i class="fa fa-circle text-navy"></i>非会员零售复购率：' + result.noVipRetailRepeatChargeRate + '%</a></li>';
                        $("#repeatChargeRateDetail").html(innerHtml);
                        $('.modal-loading').hide();
                        $('.bs-example-modal-lg-4').modal('toggle');
                    }
                }
            });
        });

        /**
         $("#modal-5").click(function () {
        	$("#weekCourseCountDetailDiv").empty();
        	debugger;
        	var innerHtml="";
        	var list = new Array();
        	list=JSON.parse($("#weekCourseCountDetail").val());
        	
        	$.each(list, function (i, data) {
    			innerHtml+='<li><a href="#"><i class="fa fa-circle text-navy"></i>'+data.name+':'+data.rate+'</a></li>';
        	});
        	$("#weekCourseCountDetailDiv").html(innerHtml);
            $('.bs-example-modal-lg-5').modal('toggle');
        });
         */
        $("#modal-5").click(function () {
            debugger;
            $("#weekCourseCountDetailDiv").empty();
            var start_weekrange = $("#start_weekrange").val();
            var end_weekrange = $("#end_weekrange").val();
            $('.modal-loading').show();
            $.ajax({
                type: "post",
                url: "queryWeekCourseCountDetail",
                data: {"start_weekrange": start_weekrange, "end_weekrange": end_weekrange},
                success: function (result) {
                    if (result) {
                        var innerHtml = "";
                        $.each(result.weekCourseCountDetail, function (i, data) {
                            innerHtml += '<li><a href="#"><i class="fa fa-circle text-navy"></i>' + data.name + ':' + data.rate + '</a></li>';
                        });
                        $("#weekCourseCountDetailDiv").html(innerHtml);
                        $('.modal-loading').hide();
                        $('.bs-example-modal-lg-5').modal('toggle');
                    }
                }
            });

        });

        /**
         $("#modal-6").click(function () {
        	$("#teamFullClassRateDetailDiv").empty();
        	debugger;
        	var innerHtml="";
        	var list = new Array();
        	list=JSON.parse($("#teamFullClassRateDetail").val());
        	
        	$.each(list, function (i, data) {
    			innerHtml+='<li><a href="#"><i class="fa fa-circle text-navy"></i>'+data.name+':'+data.rate+'%</a></li>';
        	});
        	$("#teamFullClassRateDetailDiv").html(innerHtml);
            $('.bs-example-modal-lg-6').modal('toggle');
        });
         */
        $("#modal-6").click(function () {
            debugger;
            $("#teamFullClassRateDetailDiv").empty();
            var daterange_value = $("#daterange_value").val();
            $('.modal-loading').show();
            $.ajax({
                type: "post",
                url: "queryTeamFullClassRateDetail",
                data: {"daterange": daterange_value},
                success: function (result) {
                    if (result) {
                        debugger;
                        var innerHtml = "";
                        $.each(result.teamFullClassRateDetail, function (i, data) {
                            innerHtml += '<li><a href="#"><i class="fa fa-circle text-navy"></i>' + data.name + ':' + data.rate + '%</a></li>';
                        });
                        $("#teamFullClassRateDetailDiv").html(innerHtml);
                        $('.modal-loading').hide();
                        $('.bs-example-modal-lg-6').modal('toggle');
                    }
                }
            });
        });

    })
</script>

</@body.page>
</html>